package objects;

public class StudentTest {
	public static void main(String[] args) {
		//定义对象数组
		Student[] stu=new Student[20];
		//
		for (int i = 0; i < stu.length; i++) {
			//对每个数组元素赋值
			stu[i]=new Student();
			//学号赋值
			stu[i].number=i+1;
			//年级1-6
			stu[i].state=(int)((Math.random()*(6-1+1))+1);
			//成绩1-100
			stu[i].score=(int)(Math.random()*100+1);
		}
		
		//遍历数组
		for (int i = 0; i < stu.length; i++) {
			System.out.println(stu[i]);
		}
		
		
	}
}

class Student{
	int number;//学号
	int score;//成绩
	int state;//年级
}